<?php
namespace app\system\controller;

use app\common\model\ShopPromotionAuctionModel;
use app\common\model\ShopPromotionGroupbuyModel;
use app\common\model\ShopPromotionLimitModel;
use app\common\model\ShopPromotionPointModel;
use app\common\model\ShopPromotionPresellModel;
use think\Controller;
use think\Request;

class ShopPromotionController extends BaseController
{
    protected $goodsId;

    /**
     * 初始化
     */
    public function __construct(Request $request)
    {
        parent::__construct($request);
        $this->goodsId = $this->request->param('goods_id', 0);

    }

    /**
     * 普通商品
     */
    public function getHtml0()
    {
        echo '';
    }

    /**
     * 预售商品
     * @return Controller
     */
    public function getHtml1()
    {
        $model = new ShopPromotionPresellModel();
        $info  = [];
        if ($this->goodsId) {
            $info = $model->where(['goods_id' => $this->goodsId])->find();
        }
        $this->assign('info', $info);
        return $this->fetch();
    }

    /**
     * 限时秒杀
     * @return Controller
     */
    public function getHtml2()
    {
        $model = new ShopPromotionLimitModel();
        $info  = [];
        if ($this->goodsId) {
            $info = $model->where(['goods_id' => $this->goodsId])->find();
        }
        $this->assign('info', $info);
        return $this->fetch();
    }

    /**
     * 积分
     * @return Controller
     */
    public function getHtml3()
    {
        $model = new ShopPromotionPointModel();
        $info  = [];
        if ($this->goodsId) {
            $info = $model->where(['goods_id' => $this->goodsId])->find();
        }
        $this->assign('info', $info);
        return $this->fetch();
    }

    /**
     * 集采
     * @return Controller
     */
    public function getHtml4()
    {
        $model = new ShopPromotionGroupbuyModel();
        $info  = [];
        if ($this->goodsId) {
            $info = $model->where(['goods_id' => $this->goodsId])->find();
        }
        $this->assign('info', $info);
        return $this->fetch();
    }

    /**
     * 竞拍
     * @return Controller
     */
    public function getHtml5()
    {
        $model = new ShopPromotionAuctionModel();
        $info  = [];
        if ($this->goodsId) {
            $info = $model->where(['goods_id' => $this->goodsId])->find();
        }
        $this->assign('info', $info);
        return $this->fetch();
    }
}
